<template>
	<view class="header">
		<view class="container">
				<view v-for="(certificate, index) in certificates" :key="index" class="certificate">
					<image :src="certificate.imagePath" class="certificate-image" mode="aspectFill"></image>
					<text class="certificate-title">{{certificate.description}}</text>
				</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		reactive
	} from 'vue'
	import {
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import {
		useStore
	} from '@/store/counter.js';
	import {
		storeToRefs,
	} from 'pinia'
	import {
		passenger
	} from "@/api/index.js"

	// 模拟从后台读取的数据
	const certificates = ref([{
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/sku1.png',
			title: "奖状1"
		},
		{
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/RTkJqu4KOxiy.png',
			title: "奖状1"
		}, {
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/RTkJqu4KOxiy.png',
			title: "奖状1"
		}, {
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/RTkJqu4KOxiy.png',
			title: "奖状1"
		}, {
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/RTkJqu4KOxiy.png',
			title: "奖状1"
		}, {
			image: 'https://aw2025ht.kangye.xyz/api/profile/upload/RTkJqu4KOxiy.png',
			title: "奖状1"
		},
	]);


	const {
		role
	} = storeToRefs(useStore());
	const list = ref([]);
	const active = ref(3)
	onShow(async() => {

		// 加载的时候，默认去数据库查询，然后给到数组对象
		 let res = await passenger.selectAllYanFa()
		 certificates.value = res.data
		 console.log(res)
		 console.log(res.data)
		
	})
	
</script>

<style scoped>
	.section image {
		width: 100%;
	}

	.history {
		position: relative;
	}

	.history-bg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
	}

	.section-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10px;
	}

	.section-title {
		font-size: 20px;
		font-weight: bold;
		color: white;
	}

	.section-arrow {
		color: white;
	}

	.section-content {
		margin-top: 5px;
	}

	.section-description {
		font-size: 14px;
		color: white;
		line-height: 1.5;
	}

	.header {
		position: relative;
		width: 100%;
		height: 180px;
		background: linear-gradient(to bottom, #1c6ddc, #f2f4f7);
		/* display: flex; */
		/* justify-content: flex-start; */
		/* align-items: flex-start; */
		padding-top: 20px;
		z-index: 10;
	}

	.title {
		color: white;
		font-size: 40rpx;
		font-weight: bold;
		margin-left: 40rpx;
		width: 90%;
		text-align: center;
		height: 150rpx;
		line-height: 158rpx;
	}

	.container {
		    padding: 0 40rpx;
		    display: flex;
		    flex-wrap: wrap;
		    justify-content: space-between;
	}

	.banner {
		margin: 10px 0;
		border-radius: 20px;
		overflow: hidden;
		height: 419rpx;
	}

	.banner-image {
		width: 100%;
		height: 100%;
	}

	.section {
		background-color: white;
		border-radius: 20px;
		margin-bottom: 20px;
		padding: 20px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		overflow: hidden;
		height: 100px;
	}

	.section-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10px;
	}

	.section-title {
		font-size: 20px;
		font-weight: bold;
		color: #333;
	}

	.section-arrow {
		color: #666;
	}

	.section-content {
		margin-top: 5px;
	}

	/* 777 */
	.section-description {
		font-size: 14px;
		color: #666;
		line-height: 1.5;
	}

	.history {
		background: linear-gradient(to right, #007aff, #00aaff);
		background-image: url("https://aw2025ht.kangye.xyz/api/profile/upload/eB0SURyoRcfm.jpg");
		color: white;
	}

	.honor {
		background: linear-gradient(to right, #8B4513, #CD853F);
		color: white;
	}

	.team {
		background: linear-gradient(to right, #CD853F, #D2B48C);
		color: white;
	}

	.application {
		background: linear-gradient(to right, #007aff, #00aaff);
		color: white;
	}

	.section-group {
		display: flex;
		margin-bottom: 20px;
	}

	.honor {
		flex: 1;
		margin-right: 10px;
	}

	.section-right {
		display: flex;
		flex-direction: column;
	}

	.team,
	.application {
		flex: 1;
		margin-bottom: 10px;
	}



	.certificate {
		    width: 47%;
		    height: 176rpx;
		    margin-bottom: 80rpx;
		    border: 2rpx solid #ccc;
		    /* padding: 20rpx; */
		    box-shadow: 4rpx 4rpx 10rpx rgba(0, 0, 0, 0.1);
		    text-align: center;
	}

	.certificate-image {
		
		    width: 100%;
		    margin-bottom: 20rpx;
		    height: 176rpx;

	}

	.certificate-title {
		font-size: 12px;
		font-weight: bold;
		color: #333;
	}
</style>